<?php 
ini_set('display_errors', '0');
$ismailed=0;
$tmpName = $_FILES['doc1']['tmp_name']; 
$fileType = $_FILES['doc1']['type']; 
$fileName = $_FILES['doc1']['name']; 
	if (isset($_POST['email']) && $_POST['email']!='')
    {
	  $name=$_REQUEST['name'];
	  $company=$_REQUEST['company'];
	  $email=$_REQUEST['email'];
	  $phone=$_REQUEST['phone'];
	  $projectType=$_REQUEST['projectType'];
	  $doc1 = $_REQUEST['doc1'];
	  $description=$_REQUEST['description'];
	  $ipaddress = $_SERVER['REMOTE_ADDR'];
	  $random_hash = md5(date('r', time())); 
	  $headers = "From: " . strip_tags($email) . "\r\n";
	  $headers .= "MIME-Version: 1.0\r\n";
	  $subject="Get A Free Quote!";
	  $message ="<table border='' class='table table-striped'><tr class='success'><tr><td>Name:</td><td>$name</td></tr>
	  <tr><td>Company:</td><td>$company</td></tr>
	  <tr><td>Email:</td><td>$email</td></tr>
		<tr><td>Phone:</td><td>$phone</td></tr>
		<tr><td>ProjectType:</td><td>$projectType</td></tr>
		 <tr><td>Doc:</td><td>$doc1</td></tr>
		 <tr><td>Description:</td><td>$description</td></tr>
		<tr><td>IP:</td><td>$ipaddress</td></tr></tr>
	  </table>";
	  if (file($tmpName)) { 
		/* Reading file ('rb' = read binary)  */
		  $file = fopen($tmpName,'rb'); 
		  $data = fread($file,filesize($tmpName)); 
		  fclose($file); 

		/* a boundary string */
		  $randomVal = md5(time()); 
		  $mimeBoundary = "==Multipart_Boundary_x{$randomVal}x"; 

		/* Header for File Attachment */
		  $headers .= "Content-Type: multipart/mixed;\n" ;
		  $headers .= " boundary=\"{$mimeBoundary}\"";
		  $message = "This is a multi-part message in MIME format.\n\n" .
		  "--{$mimeBoundary}\n" .
		  "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
		  "Content-Transfer-Encoding: 7bit\n\n" .
		  $message . "\n\n";  
		  $data = chunk_split(base64_encode($data)); 
		/* Adding attchment-file to message*/
		  $message .= "--{$mimeBoundary}\n" . 
		  "Content-Type: {$fileType};\n" . 
		  " name=\"{$fileName}\"\n" . 
		  "Content-Transfer-Encoding: base64\n\n" . 
		  $data . "\n\n" . 
		  "--{$mimeBoundary}--\n"; 
		}else{
	            $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
	        }
			$to = 'info@aapthitech.com';
			$ismailed=mail($to,$subject,$message, $headers);
	    //mail($to,$subject,$message,$headers);
	    if($ismailed){
			 $_REQUEST['email']="";
			 unset($_REQUEST['field']);
		}
	  //echo "Thank you for using our mail form";
    }
?>

   <?php include('header.php')?>
   <div><img class="img_w" src="assets/img/web-icons/getquote.png" alt="Get Quote"></div>
<div class="contact-us container">
<div class="row">
	<div class="span9">
                  <div class="contact-us ">
                <div>
				<h4>Get in touch with US</h4>
                    <p>Got a question or ready to get started? We would love to work with you and are waiting for you to drop us a line. Please fill out the form below to get in touch with us. We’ll be sure to get back to you as soon as we can. </p>
					<?php if( $ismailed!=0){
							?>
								<script>
									window.location = 'ask-quote?success=true';
								</script>
							<?php
						}
						if($_GET['success']){
					echo "<p class='message_style' id='successMessage'><b>Thank you for contacting us, We will get back to you soon.</b></p> ";
					}
					?>
                    <form method="post" onsubmit="return validate()" enctype="multipart/form-data" name="test" id="test">
                        <label for="name"> Full Name<span>*</span> <span id="errorfname" style="color:#ff0000; font-style: italic"></span></label>
                           <input name="name" type="text" class="textboxheight" id="name" placeholder="Enter your name..." autofocus/>
                        <label for="company" class="">  Company Name: <span id="errorcompany" style="color:#ff0000; font-style: italic"></span></label>
                          <input name="company" type="text" class="textboxheight" id="company" placeholder="Enter your company name..." />
                        <label for="email">  Email Address<span>*</span>: <span id="erroremail" style="color:#ff0000; font-style: italic"></span></label>
                          <input name="email" type="email" class="textboxheight" id="email" placeholder="Enter your email..." />
                        <label for="phone" class=""> Phone Number<span>*</span>:<span id="errorphone" style="color:#ff0000; font-style: italic"></span></label>
                         <input name="phone" type="text" class="textboxheight" id="phone" placeholder="Enter your phone number..."/>
						 
						 <label for="projectType" class="">Project Type<span>*</span>:<span id="errorprojectType" style="color:#ff0000; font-style: italic"></span></label>
                        <select name="projectType" class="request_field_list" id="projectType" style="width:92% !important" >
						<option selected="selected" value="">-Select your option -</option>
						   <option value="Mobile App Development">Mobile App Development</option>
						   <option value="Web App Development">Web App Development</option>
						   <option value="Ecommerce Website">Ecommerce Website</option>
						   <option value="Web Design / CMS">Web Design / CMS</option>
						   <option value="SEO & Social Media">SEO & Social Media</option>
						   <option value="Dedicated Resource">Dedicated Resource</option>
						   <option value="Logo / Stationary Design">Logo / Stationary Design</option>
						   <option value="Others">Others</option>
						</select>
						 
						 <label for="doc1" class=""> Upload Related Documents: <span id="errordoc1" style="color:#ff0000; font-style: italic"></span> </label>
						 <div class="filestyle">
							<input type="file" class="textboxheight" name="doc1" id="doc1" style="border:none !important" accept="image/gif, image/x-png, image/jpeg"/>
							</div>
						 
						 <label for="description" class=""> Project Description<span>*</span>: <span id="errordescription" style="color:#ff0000; font-style: italic"></span> </label>
                        <textarea name="description" cols="45" rows="5" class="" id="description" placeholder="Enter projectType.."></textarea>
					    <label for="message" class="messageLabel">Captcha<span id="errorCaptchavalidation" name="errorCaptchavalidation" style="color:#ff0000; font-style: italic"></span></label>
						<input type="text" class="captcha_input textboxheight" name="captcha" id="captcha"/>
			            <input type="text" class="img_captcha textboxheight" id="refreshCode" name="refreshCode" readonly="readonly" disabled="disabled" value=""/>
						<!--<span id="errorCaptchavalidation" name="errorCaptchavalidation" style="color:red;"></span>-->
						<img class="img_refresh" src="assets/img/refresh.png"  onclick="return refresh()"/><br/>
					  <!--<label for="verify" class=""> Enter the code shown <span>*</span>: <span id="errorverify" style="color:#ff0000 ;font-style: italic" ></span> </label>
						<input name="verify" type="text" class="textboxheight" id="verify"/>
                        <input  type="submit" value="Send">-->
						     <button  type="submit" >Send</button>
                    </form>
                </div>
        </div>


    </div>
		<div class="contact-address span3" style="margin-top:25px !important">
			<h4 >Address</h4>
			<p>Plot No -5, Beside Vasireddy Swagruha Foods,
			<br />Vivekananda nagar colony, Kukatapally,
			<br />Hyderabad - 500072, India. </p>
			<p>
			<strong>Enquiry Numbers</strong><br/>
			<i class="fa fa-phone"></i>
			<span class="heigh_let_c">+91-8897742021</span><br>
			<strong>Skype</strong><br/>
			<img src="assets/img/skype.png"/>
			<span class="heigh_let_c">sam.phpdev</span><br>
			<b>For Business Enquiry</b><br/>
			<i class="fa fa-envelope"></i>
			 <a href="mailto:info@aapthitech.com" class="heigh_let_c">info@aapthitech.com</a><br/>
			<b>For Support Enquiry</b><br/>
			<i class="fa fa-envelope"></i>
			 <a href="mailto:info@aapthitech.com" class="heigh_let_c">info@aapthitech.com</a><br/>
			 <b>For Jobs Enquiry</b><br/>
			<i class="fa fa-envelope"></i>
			<a href="mailto:info@aapthitech.com" class="heigh_let_c">hr@aapthitech.com</a> 
			</p>
	</div>
</div>
</div>
<a href="#" class="scrollup">Scroll</a>


<script>
    $(document).ready(function() {
	refresh();
    });
function validate()
	{
	//alert('aaaaaaaaaaaaa');return false;
			var flag=true;
			if($('#name').val()==""){
			$('#errorfname').html('-Name Required');
			flag=false;
			}else{
			$('#errorfname').html('');
			}
			
			
			if($('#company').val()==""){
			$('#errorcompany').html('-Company Name Required');
			flag=false;
			}else{
			$('#errorcompany').html('');
			}
			
			if($('#email').val()==""){
			$('#erroremail').html('-Email Required');
			flag=false;
			}else{
			$('#erroremail').html('');
			}
			
			if($('#phone').val()==""){
			$('#errorphone').html('-Phone Number Required');
			flag=false;
			}else{
			$('#errorphone').html('');
			}
		
			if($('#projectType').val()==""){
			$('#errorprojectType').html('-ProjectType  Required');
			flag=false;
			}else{
			$('#errorprojectType').html('');
			}
			
			/*if($('#doc1').val()==""){
			$('#errordoc1').html('-Upload Related Documents Required');
			flag=false;
			}else{
			$('#errordoc1').html('');
			}*/
			
			if($('#description').val()==""){
			$('#errordescription').html('-Description Required');
			flag=false;
			}else{
			$('#errordescription').html('');
			}
			
			if($('#verify').val()==""){
			$('#errorverify').html('-Verification Code Required');
			flag=false;
			}else{
			$('#errorverify').html('');
			}
			
			if($('#captcha').val()==""){
			$('#errorCaptchavalidation').html('-Captcha Required');
			$('#captcha').focus();
			flag=false;
			}else if($('#captcha').val()!=$("#refreshCode").val()){ 
             $("#errorCaptchavalidation").html("Please enter the correct code");
	         flag=false;
			}else{
			   $('#errorCaptchavalidation').html('');
			}
			
			if(flag==false){
			return false;
			}else{
					return true;
			}
	}
	function refresh(){
	$.ajax({
		url: "captchacgetcode.php",
		type: "POST",				
		success: function(msg){ 
			$("#refreshCode").val(msg);
		},				
	});   
}
	$('#successMessage').delay(6000).fadeOut('slow');
</script>
<?php include('footer.php')?>
